package org.tea.crawl.biz.configuration;

import org.apache.ibatis.io.Resources;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author lxh
 */
@Configuration
public class RedisConfiguration {

    @Bean(name = "crawlRedisson")
    public RedissonClient crawlRedisson() {
        try {
            Config config = Config.fromYAML(Resources.getResourceURL("config-redisson.yml"));
            return Redisson.create(config);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
